package com.itheima.mapper;

import com.itheima.pojo.CheckGroup;
import com.itheima.pojo.CheckItem;
import com.itheima.pojo.Setmeal;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.Mapping;

import java.util.List;

@Mapper
public interface SetmealMapper {


    /**
     * @author : mashuning
     * 查询所有套餐
     * @return
     */
    @Select("select * from t_setmeal")
    List<Setmeal> getSetmealAll();



    /**
     * @author : mashuning
     * 根据套餐id查询套餐
     * @param id
     * @return
     */
    @Select("select * from t_setmeal where id = #{id}")
    Setmeal getSetmealById(Integer id);

    /**
     * @author : mashuning
     * 根据套餐id查询套餐关联的检查组
     * @param id
     * @return
     */
    @Select("select * from t_checkgroup where id in (select checkgroup_id from t_setmeal_checkgroup where setmeal_id = #{id})")
    List<CheckGroup> getCheckGroupsBySetmealId(Integer id);


    List<CheckItem> getCheckItemsByCheckGroupIds(List<Integer> checkGroupIds);


//    Setmeal findById(Integer id);
}
